/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package facades.persistence;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Alvaro
 */
@Entity
@Table(name = "user")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "User.findAll", query = "SELECT u FROM User u")})
public class User implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "iduser")
    private Integer iduser;
    @Size(max = 45)
    @Column(name = "name")
    private String name;
    @Size(max = 45)
    @Column(name = "lastname")
    private String lastname;
    @Size(max = 45)
    @Column(name = "birth")
    private String birth;
    // @Pattern(regexp="[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?", message="Invalid email")//if the field contains email address consider using this annotation to enforce field validation
    @Size(max = 45)
    @Column(name = "email")
    private String email;
    @Size(max = 45)
    @Column(name = "account")
    private String account;
    @Size(max = 45)
    @Column(name = "failpal")
    private String failpal;
    @Size(max = 45)
    @Column(name = "wisa")
    private String wisa;
    @Size(max = 45)
    @Column(name = "transfer")
    private String transfer;
    @Size(max = 45)
    @Column(name = "movements")
    private String movements;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "money")
    private Float money;
    @Size(max = 45)
    @Column(name = "cardnumber")
    private String cardnumber;
    @Size(max = 45)
    @Column(name = "cardsecurity")
    private String cardsecurity;
    @OneToMany(mappedBy = "userIduser")
    private List<MovementWisaFastercard> movementWisaFastercardList;
    @OneToMany(mappedBy = "userIduser")
    private List<MovementFailpal> movementFailpalList;
    @OneToMany(mappedBy = "userIduser")
    private List<Movement> movementList;
    @OneToMany(mappedBy = "userIduser")
    private List<MovementTransfer> movementTransferList;

    public User() {
    }

    public User(Integer iduser) {
        this.iduser = iduser;
    }

    public Integer getIduser() {
        return iduser;
    }

    public void setIduser(Integer iduser) {
        this.iduser = iduser;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getLastname() {
        return lastname;
    }

    public void setLastname(String lastname) {
        this.lastname = lastname;
    }

    public String getBirth() {
        return birth;
    }

    public void setBirth(String birth) {
        this.birth = birth;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getAccount() {
        return account;
    }

    public void setAccount(String account) {
        this.account = account;
    }

    public String getFailpal() {
        return failpal;
    }

    public void setFailpal(String failpal) {
        this.failpal = failpal;
    }

    public String getWisa() {
        return wisa;
    }

    public void setWisa(String wisa) {
        this.wisa = wisa;
    }

    public String getTransfer() {
        return transfer;
    }

    public void setTransfer(String transfer) {
        this.transfer = transfer;
    }

    public String getMovements() {
        return movements;
    }

    public void setMovements(String movements) {
        this.movements = movements;
    }

    public Float getMoney() {
        return money;
    }

    public void setMoney(Float money) {
        this.money = money;
    }

    public String getCardnumber() {
        return cardnumber;
    }

    public void setCardnumber(String cardnumber) {
        this.cardnumber = cardnumber;
    }

    public String getCardsecurity() {
        return cardsecurity;
    }

    public void setCardsecurity(String cardsecurity) {
        this.cardsecurity = cardsecurity;
    }

    @XmlTransient
    public List<MovementWisaFastercard> getMovementWisaFastercardList() {
        return movementWisaFastercardList;
    }

    public void setMovementWisaFastercardList(List<MovementWisaFastercard> movementWisaFastercardList) {
        this.movementWisaFastercardList = movementWisaFastercardList;
    }

    @XmlTransient
    public List<MovementFailpal> getMovementFailpalList() {
        return movementFailpalList;
    }

    public void setMovementFailpalList(List<MovementFailpal> movementFailpalList) {
        this.movementFailpalList = movementFailpalList;
    }

    @XmlTransient
    public List<Movement> getMovementList() {
        return movementList;
    }

    public void setMovementList(List<Movement> movementList) {
        this.movementList = movementList;
    }

    @XmlTransient
    public List<MovementTransfer> getMovementTransferList() {
        return movementTransferList;
    }

    public void setMovementTransferList(List<MovementTransfer> movementTransferList) {
        this.movementTransferList = movementTransferList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (iduser != null ? iduser.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof User)) {
            return false;
        }
        User other = (User) object;
        if ((this.iduser == null && other.iduser != null) || (this.iduser != null && !this.iduser.equals(other.iduser))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "facades.persistence.User[ iduser=" + iduser + " ]";
    }
    
}
